import { IsString, IsInt, IsNotEmpty, MinLength } from "class-validator";
import { ApiProperty } from "@nestjs/swagger";

export class CreateUserDto {
  @ApiProperty({
    type: String,
    description: "用户姓名必填",
    required: true,
    default: "",
  })
  @IsNotEmpty({ message: "用户姓名必填" })
  @IsString({ message: "用户姓名为字符串" })
  readonly nickname: string;

  @ApiProperty({
    type: String,
    description: "性别",
    required: false,
    default: "",
  })
  readonly gender: string;

  @ApiProperty({
    type: String,
    description: "帐号",
    required: true,
    default: "",
  })
  @IsNotEmpty({ message: "帐号必填" })
  @MinLength(6, { message: "帐号长度不能少于6位" })
  readonly account: string;

  @ApiProperty({
    type: String,
    description: "密码",
    required: true,
    default: "",
  })
  @IsNotEmpty({ message: "密码必填" })
  @MinLength(6, { message: "密码长度不能少于6位" })
  readonly pwd: string;
}
